document.getElementById('generateButton').addEventListener('click', generateSentence);

const 人称代词 = ["我", "你", "他", "她", "它", "他们", "她们", "它们"];
const 动词 = ["吃", "喝", "玩", "跑", "走", "跳"];
const 情绪 = ["喜欢", "不喜欢", "爱", "不爱"];
const 名词 = ["电脑", "馒头", "饼干", "跑车", "公交车", "键盘", "手机", "鼠标", "呼啦圈", "跳绳", "桌子", "椅子"];

function getRandomElement(array) {
    return array[Math.floor(Math.random() * array.length)];
}

function generateSentence() {
    const p1 = getRandomElement(人称代词);
    const p2 = getRandomElement(动词);
    const p3 = getRandomElement(情绪);
    const p4 = getRandomElement(名词);

    const result = `${p1} ${p2} ${p3} ${p4}`;
    document.getElementById('result').innerText = result;
}
